﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Controls;
using WinAutomator.Library;

namespace WinAutomator.Plugin.BuildIns
{
    public class WAMessageBoxPlugin : IPlugin
    {
        UserControl _control;
        WAMessageBoxProcess _process;
        WAMessageBoxViewModel _viewModel;

        public WAMessageBoxPlugin()
        {
            _process = new WAMessageBoxProcess();
        }

        public WAMessageBoxViewModel GetViewModel()
        {
            if (_viewModel == null)
                _viewModel = new WAMessageBoxViewModel();

            return _viewModel;
        }

        public UserControl GetUserControl()
        {
            if (_control == null)
            {
                _control = new WAMessageBox();
                _control.DataContext = GetViewModel();
            }

            return _control;
        }

        public IProcess GetProcess()
        {
            return _viewModel.Model;
        }

        public string Name
        {
            get { return "WAMessageBoxPlugin"; }
        }


        public string ToolBoxImageSource
        {
            get { return "/WinAutomator.Plugin.BuildIns;component/Images/1.png"; }
        }

        #region IPlugin Membres


        public Control UserControl
        {
            get { return GetUserControl(); }
        }

        public IProcess Process
        {
            get { return GetProcess(); }
        }

        #endregion

        #region IPlugin Membres


        public PluginViewModel ViewModel
        {
            get { return GetViewModel(); }
        }

        #endregion
    }
}
